Rows: 15064 Columns: 24
── Column specification ──────────────────────────────────────────────────────────────────
Delimiter: ","
chr (16): UTC Date and Time, Participant Device, Participant Browser, Task Name, Displ...
dbl (8): Participant Private ID, Experiment Version, Task Version, Trial Number, rt, ...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 504 Columns: 57
── Column specification ──────────────────────────────────────────────────────────────────
Delimiter: ","
chr (38): UTC Date and Time, Participant Device, Participant Browser, randomiser-evbs,...
dbl (19): Participant Private ID, Experiment Version, attention_start object-14 Quanti...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data <- data_analysisdata_com <- data_combined
Create new classification variables
Create variables that code high/low education, high/low crt, and high/low Go/No-Go
# save itdata_com %>%select(age_corrected, ideology_num, crt_correct, commission_errors_r ) %>%rename(Age = age_corrected,Ideology = ideology_num,`Cognitive Reflection`= crt_correct,`Inhibitory Control`= commission_errors_r ) %>%datasummary_skim(fun_numeric =list(Mean = Mean, SD = SD, Min = Min, Median = Median, Max = Max )) %>%save_tt(here(table_dir, "variable_descriptives.docx"), overwrite =TRUE)
Correlations between measured variables (questionnaires and tasks)
data_corr <- data_quest %>%select(`Participant Private ID`, o_immigration:o_brain, o_discrimination, o_selfenhancement:o_gender) %>%left_join(data_com, by ="Participant Private ID") %>%mutate(across(o_immigration:o_gender, ~recode(.x,"Strongly disagree"=1,"Disagree"=2,"Neutral"=3,"Agree"=4,"Strongly agree"=5 ))) %>%select(age_corrected, ideology_num, crt_correct, commission_errors_r, o_immigration:o_gender) %>%rename("Anti-Immigration"= o_immigration, # Too many immigrants"Belief in Discrimination"= o_discrimination, # Racial discrimination is a barrier"Climate Change Belief"= o_climate, # Earth is getting warmer due to human activity"Pro-Same-Sex Adoption"= o_adoption, # No reasons to prevent same-sex adoption"Pro-Harsh Punishments"= o_punishment, # Harsher punishments reduce crime"Belief in Male Superiority"= o_gender, # Men are more talented in math-related fields"Low Self-Evaluation"= o_selfenhancement, # Abilities not as good as others"Tea with Milk"= o_teaculture, # Tea with milk preference"Brain Function Superiority"= o_brain, # Human brain's superior functionAge = age_corrected,Ideology = ideology_num,`Cognitive Reflection`= crt_correct,`Inhibitory Control`= commission_errors_r ) %>%mutate(across(everything(), as.numeric))
# correlation analysiscorrs <-cor(data_corr, use ="pairwise.complete.obs")corrs_p <-cor.mtest(data_corr, conf.level =0.95)# plot it col <-colorRampPalette(c("#4477AA", "#77AADD", "#FFFFFF", "#EE9988", "#BB4444"))corrplot(corrs, method="color", col=col(200), type="upper", order="original", addCoef.col ="black", # Add coefficient of correlationtl.col="black", tl.srt=45, # Text label color and rotation,# p.mat = corrs_p$p, sig.level = 0.05, insig = "blank", diag=FALSE, number.cex=0.85 )
# save itpng(filename =here(fig_dir, "correlation_plot.png"), width =10, height =10, units ="in", res =300)corrplot(corrs, method="color", col=col(200), type="upper", order="original", addCoef.col ="black", # Add coefficient of correlationtl.col="black", tl.srt=45, # Text label color and rotation,#p.mat = corrs_p$p, sig.level = 0.05, insig = "pch", diag=FALSE, number.cex=0.85 )dev.off()